package com.ruoyi.risk.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.mapper.RiskCostRecordInfoMapper;
import com.ruoyi.db.domain.RiskCostRecordInfo;
import com.ruoyi.risk.service.IRiskCostRecordInfoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 风控消费记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-05-28
 */
@Service
@DataSource(DataSourceType.SLAVE)
public class RiskCostRecordInfoServiceImpl implements IRiskCostRecordInfoService 
{
    @Autowired
    private RiskCostRecordInfoMapper riskCostRecordInfoMapper;

    /**
     * 查询风控消费记录
     * 
     * @param id 风控消费记录主键
     * @return 风控消费记录
     */
    @Override
    public RiskCostRecordInfo selectRiskCostRecordInfoById(Long id)
    {
        return riskCostRecordInfoMapper.selectRiskCostRecordInfoById(id);
    }

    /**
     * 查询风控消费记录列表
     * 
     * @param riskCostRecordInfo 风控消费记录
     * @return 风控消费记录
     */
    @Override
    public List<RiskCostRecordInfo> selectRiskCostRecordInfoList(RiskCostRecordInfo riskCostRecordInfo)
    {
        return riskCostRecordInfoMapper.selectRiskCostRecordInfoList(riskCostRecordInfo);
    }

    /**
     * 查询风控消费记录列表
     *
     * @param riskCostRecordInfo 风控消费记录
     * @return 风控消费记录
     */
    @Override
    public List<Map<String, Object>> selectRiskCostRecordInfoListMap(RiskCostRecordInfo riskCostRecordInfo)
    {
        return riskCostRecordInfoMapper.selectRiskCostRecordInfoListMap(riskCostRecordInfo);
    }

    /**
     * 新增风控消费记录
     * 
     * @param riskCostRecordInfo 风控消费记录
     * @return 结果
     */
    @Override
    public int insertRiskCostRecordInfo(RiskCostRecordInfo riskCostRecordInfo)
    {
        riskCostRecordInfo.setCreateTime(DateUtils.getNowDate());
        return riskCostRecordInfoMapper.insertRiskCostRecordInfo(riskCostRecordInfo);
    }

    /**
     * 修改风控消费记录
     * 
     * @param riskCostRecordInfo 风控消费记录
     * @return 结果
     */
    @Override
    public int updateRiskCostRecordInfo(RiskCostRecordInfo riskCostRecordInfo)
    {
        riskCostRecordInfo.setUpdateTime(DateUtils.getNowDate());
        return riskCostRecordInfoMapper.updateRiskCostRecordInfo(riskCostRecordInfo);
    }

    /**
     * 批量删除风控消费记录
     * 
     * @param ids 需要删除的风控消费记录主键
     * @return 结果
     */
    @Override
    public int deleteRiskCostRecordInfoByIds(String ids)
    {
        return riskCostRecordInfoMapper.deleteRiskCostRecordInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除风控消费记录信息
     * 
     * @param id 风控消费记录主键
     * @return 结果
     */
    @Override
    public int deleteRiskCostRecordInfoById(Long id)
    {
        return riskCostRecordInfoMapper.deleteRiskCostRecordInfoById(id);
    }
}
